import {Component} from '@angular/core';
import {Subscription} from 'rxjs';
import {RequestClientService} from '../../../apiServices/request-client.service';
import { normalize } from 'path';
import { NormalService } from '../../../apiServices/normal.service';

@Component({
    selector: 'security',
    templateUrl: './security.template.html',
    styleUrls: ['./security.style.scss']
})

export class SecurityComponent {
    public language: string = 'en';
    public user: any;
    private userSubscription: Subscription;
    public userVerified: string = '';

    public textConfig: any = {
        state: {
            certified:{
                en: 'Certified', zh: '已认证'
            },
            unCertified: {
                en: 'Not certified', zh: '未认证'
            }
        }
        
    }

    constructor(
        private requestClientService: RequestClientService,
        private normalService: NormalService,
    ) {
        this.language = requestClientService.language;
        // this.language = normalService.lang;
        this.userSubscription = this.normalService.request$.subscribe(next => {
            if (next.code == 200 && next.name == 'user') {
                this.user = next.data.user;
            }
        });
    
        this.normalService.getUser({ObservableName: "user"}).then(user=>{
            console.log('user', user);
        });

    }
}